﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Microsoft.Reporting.WebForms;

namespace PeisongWeb.admin
{
    public partial class reportBuyerProductDetail : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt;
                if (Request.QueryString["rb"] != null || Request.QueryString["order"] != null)
                {
                    string rbno = Request.QueryString["rb"].ToString();
                    string orderno = "";
                    if (Request.QueryString["order"] != null)
                        orderno = Request.QueryString["order"].ToString();
                    dt = getdata(rbno, orderno);
                    ReportDataSource rds = new ReportDataSource("reportCustomerDetail_DataTable1", dt);
                    ReportViewer1.LocalReport.DataSources.Clear();
                    ReportViewer1.LocalReport.DataSources.Add(rds);
                    ReportViewer1.LocalReport.Refresh();
                    if (dt.Rows.Count == 0)
                    {
                        ReportViewer1.Visible = false;
                        div_nodata.Visible = true;
                    }
                    else
                    {
                        div_nodata.Visible = false;
                    }
                }
                else
                {
                    Library.Script.ClientMsgUrl("错误的参数。", "reportCustomer.aspx");
                }
            }
        }

        protected DataTable getdata(string rbno, string orderno)
        {
            return DAL.DbHelper.ExecuteDataTable("p_report_customer_detail", rbno, orderno);
        }
    }
}
